/*
 * Copyright (C) 2009 M. Hautle.
 * 
 * This file is part of TrackedBean.
 * 
 * TrackedBean is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * TrackedBean is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with TrackedBean. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.trackedbean.data;

import ch.trackedbean.copier.annotations.*;
import ch.trackedbean.data.evaluator.*;
import ch.trackedbean.loaders.lazy.*;
import ch.trackedbean.validator.annotations.*;

/**
 * TO for {@link DomD}.
 * 
 * @author M. Hautle
 */
public class TOD {

    public static final String ATTR_AOTHER_DOM = "aotherDom";

    public static final String ATTR_TEXT = "text";

    /**
     * Property mapped on {@link DomD#ATTR_OTHER_DOM}. {@link DomEvaluator} will be used to figure out the TO type of an dom and {@link ToEvaluator} will be
     * used to figure out the dom type of an TO.
     */
    @DeepValidation
    @DeepMapping(srcProperty = DomD.ATTR_OTHER_DOM, srcEvaluator = DomEvaluator.class, dstEvaluator = ToEvaluator.class, srcClass = DomD.class)
    private TOA aotherDom;

    /** Property mapped on {@link DomA#ATTR_TEXT_A} via {@link DomD#ATTR_SUB_DOM}.{@link DomD#ATTR_OTHER_DOM}. */
    @PathMapping(path = DomD.ATTR_SUB_DOM + "." + DomD.ATTR_OTHER_DOM + "." + DomA.ATTR_TEXT_A, lastPathType = DomA.class, srcClass = DomD.class)
    private String text;

    /** Property mapped on {@link DomD#ATTR_SUB_DOM}. */
    @DeepMapping(srcProperty = DomD.ATTR_SUB_DOM, srcEvaluator = DomEvaluator.class, dstEvaluator = ToEvaluator.class, srcClass = DomD.class)
    private TOD subDom;

    /** Property mapped on {@link DomD#ATTR_OTHER_DOM}. This property will only be copied to the TO but not back to the dom. */
    @DeepMapping(srcProperty = DomD.ATTR_OTHER_DOM, readOnly = true, srcClass = DomD.class)
    private TOA aotherDom2;

    /**
     * @return Returns the aotherDom.
     */
    @LoadLazy
    public TOA getAotherDom() {
        return aotherDom;
    }

    /**
     * @param aotherDom The aotherDom to set.
     */
    public void setAotherDom(TOA aotherDom) {
        this.aotherDom = aotherDom;
    }

    /**
     * @return Returns the text.
     */
    public String getText() {
        return text;
    }

    /**
     * @param text The text to set.
     */
    public void setText(String text) {
        this.text = text;
    }

    /**
     * @return Returns the subDom.
     */
    public TOD getSubDom() {
        return subDom;
    }

    /**
     * @param subDom The subDom to set.
     */
    public void setSubDom(TOD subDom) {
        this.subDom = subDom;
    }

    /**
     * @return Returns the aotherDom2.
     */
    public TOA getAotherDom2() {
        return aotherDom2;
    }

    /**
     * @param aotherDom2 The aotherDom2 to set.
     */
    public void setAotherDom2(TOA aotherDom2) {
        this.aotherDom2 = aotherDom2;
    }
}
